package com.user.dao;
import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;


import com.database.DataSourceUtil;
import com.user.entity.User;



public class Userdao {
	public User findUserByUsernameAndPassword(String username,String password) throws SQLException {
		QueryRunner qr = new QueryRunner(DataSourceUtil.getDataSource());
		
		String sql = "select *from users where username = ? and password = ?";
		
		return qr.query(sql,new BeanHandler<>(User.class),username,password);
	}
}
